<#include "/template/_ListPage.html" >


<#assign title="收件箱"> 
<@head>
<style>
.checkImg{
	height:20px;
	width:20px;
	background: url("${root!}/images/mail.png") -48px -0px no-repeat;
	cursor: pointer;
}
.openMail{
	height:16px;
	width:16px;
	background: url("${root!}/images/icon.png") -48px -16px no-repeat;
}
</style>
</@head>
<@center>
<div id="tb" style="height: auto">
	
	<div style="margin-bottom: 5px; border-bottom: 1px solid #ddd;">
		<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true"
			onclick="addRoleType();">新增类别</a> <a href="#"
			class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改选中</a> <a
			href="#" class="easyui-linkbutton"
			data-options="plain:true,iconCls:'icon-cancel'">删除选中</a>
	</div>
<div style="margin-bottom: 5px;">
		<form id="fm" method="post" action="${root!}/frameroletype/add">
			角色类别名称: <input name="FrameRoleType.roleTypeName" style="width: 80px">排序号:<input
			   name="FrameRoleType.order" style="width: 80px">
		</form>
	</div>
</div>

<table id="dg" toolbar="#tb">
	<thead>
		<tr>
			<th data-options="field:'ck',checkbox:true"></th>
			<th data-options="field:'hasread',width:25,formatter:checkHtml,align:'center'"></th>
			<th data-options="field:'priority',width:25,formatter:importantHtml,align:'center'"></th>
			<th data-options="field:'title',width:400,formatter:mailTitleHtml">标题</th>
			<th data-options="field:'sendUserName',width:80">发件人</th>
			<th data-options="field:'sendTime',width:100,formatter:dateHtml">时间</th>
			<th data-options="field:'id',hidden:true"></th>
		</tr>
	</thead>
</table>


<script type="text/javascript">
$(function(){
	$('#dg').datagrid({  
		url:'${root!}/framemail/table',
	    fitColumns: true,/*自动扩大或缩小列的尺寸以适应表格的宽度并且防止水平滚动*/
	    pagination:true,
	    rownumbers:true,
	    fit:true,
	    checkbox:true,
		singleSelect:true,
		selectOnCheck:false
	});
});

function checkHtml(val,row){
	var checked = val==1;
	var title = checked?"已读":"未读";
	var img = val==1?'':'<img alt="'+title+'" src="${root!}/images/mail.png">';
	return img;
}

function importantHtml(val,row){
	var checked = val==1;
	var title = checked?"标记":"未标记";
	var img = val==1?'<img alt="'+title+'" src="${root!}/images/hongqi-red.png">':'<img alt="'+title+'" src="${root!}/images/hongqi.png">';
	return img;
}

function mailTitleHtml(val,row){
	return '<a href="#" onclick="readMail(\''+row.id+'\',\''+val+'\')">'+val+'</a>';
}

function readMail(id,title){
	parent.window.FrameTab.addTab(title, "${root!}/framemail/readmail?id="+id);
}

function dateHtml(val,row){
	return DateUtil.long2Date(val,"yyyy-MM-dd HH:mm:ss");
}
</script>
</@center>